/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.chl.johanwi.jsfproducts;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

/**
 *
 * @author Schtohan
 */
@Entity
public class Product implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    @Column(nullable = false)
    private String name;
    private String cat;
    private double price;

    public Product() {
    }

    public Product(Long id, String name, String cat, double price) {
        this.id = id;
        this.name = name;
        this.cat = cat;
        this.price = price;
    }
    
    public Product(String name, String cat, double price) {
        this.name = name;
        this.cat = cat;
        this.price = price;
    }

    public String getCat() {
        return cat;
    }

    public String getName() {
        return name;
    }

    public double getPrice() {
        return price;
    }

    public void setCat(String cat) {
        this.cat = cat;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setPrice(double price) {
        this.price = price;
    }
    
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public String toString() {
        return "edu.chl.johanwi.jpa.nbp.Product[ id=" + id + " ]";
    }
    
}
